package com.dhcc.rarp.ws.service.msg.impl;

import java.util.Arrays;
import java.util.HashSet;

import javax.annotation.Resource;
import javax.jws.WebService;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.dhcc.common.utils.JaxbUtil;
import com.dhcc.framework.app.blh.mail.MailBlh;
import com.dhcc.rarp.vo.messagevo.MessageVo;
import com.dhcc.rarp.vo.msginputvo.EmailInputVo;
import com.dhcc.rarp.ws.service.msg.SendMsgWs;

/**
* <p>标题: SendMsgImpl.java</p>
* <p>业务描述:健康管理平台</p>
* <p>公司:东华软件股份公司</p>
* <p>版权:dhcc2013</p>
* @author 胡凯
* @date 2020年3月19日
* @version V1.0 
*/
@WebService(targetNamespace="http://msg.service.ws.rarp.dhcc.com/",endpointInterface = "com.dhcc.rarp.ws.service.msg.SendMsgWs")
public class SendMsgImpl implements SendMsgWs {
	private static Log logger = LogFactory.getLog(SendMsgImpl.class);
	
	@Resource
	private MailBlh mailBlh;
	
	@Override
	public String sendEmail(String inputXml) {
		EmailInputVo emailInputVo =  JaxbUtil.converyToJavaBean(inputXml, EmailInputVo.class);
		mailBlh.sendByAsync(emailInputVo.getTitle(), emailInputVo.getMsgContent(), 
				new HashSet<String>(emailInputVo.getEmails()));
		return JaxbUtil.convertToXml(new MessageVo("0","email发送成功"));
	}

	@Override
	public String sendQQ(String inputXml) {
		logger.info("qq:"+inputXml);
		return JaxbUtil.convertToXml(new MessageVo("0","qq发送成功"));
	}

	@Override
	public String sendWx(String inputXml) {
		logger.info("wx:"+inputXml);
		return JaxbUtil.convertToXml(new MessageVo("0","wx发送成功"));
	}

	@Override
	public String sendSms(String inputXml) {
		logger.info("sms:"+inputXml);
		return JaxbUtil.convertToXml(new MessageVo("0","sms发送成功"));
	}

}
